<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:replace="layout/header :: header(title=管理员)">
<body class="gray-bg">
	<div id="infos">
		<div v-show="showList" class="row wrapper wrapper-content animated fadeInRight">
			<div class="col-sm-12">
				<div class="ibox">
					<div class="ibox-title">
						<h5>用户管理</h5>
					</div>
					<div class="ibox-content">
						
						<div class=" col-sm-2" sec:authorize="hasAuthority('admin_user_list')">
							<input type="text" class="form-control" id="userName" @keyup.enter="query" placeholder="用户名称">
						</div>
						<a sec:authorize="hasAuthority('admin_user_list')" id="query" class="btn btn-info" @click="query"><i class="fa fa-search"></i>&nbsp;&nbsp;查询</a>&nbsp;&nbsp;
						<a sec:authorize="hasAuthority('admin_user_save')" id="add"	class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;&nbsp;新增</a>&nbsp;&nbsp;
						<a sec:authorize="hasAuthority('admin_user_update')" id="update"	class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;&nbsp;修改</a>&nbsp;&nbsp; 
						<a sec:authorize="hasAuthority('admin_user_delete')" id="del"	class="btn btn-danger" @click="del"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;删除</a>&nbsp;&nbsp; 
						<a sec:authorize="hasAuthority('admin_user_grant')" id= "grant" class="btn btn-primary" @click="grant"><i class="fa fa-arrows"></i>&nbsp;&nbsp;指派角色</a>&nbsp;&nbsp;
						<a sec:authorize="hasAuthority('admin_user_resetpw')" id= "grant" class="btn btn-primary" @click="resetpw"><i class="fa fa-arrows"></i>&nbsp;&nbsp;重置密码</a>&nbsp;&nbsp;
						
						<br> <br>
						<div class="row row-lg">
							<div class="col-sm-12">
								<div class="table-responsive">
									<table id="infoList"></table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div v-show="!showList"	class="row wrapper wrapper-content animated fadeInRight">
			<div class="col-sm-6 col-sm-offset-3">
				<div class="ibox">
					<div class="ibox-title">
						<h5>{{title}}</h5>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal">
							<div class="form-group">
								<div class="col-sm-2 control-label">账户名</div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="info.userName" placeholder="登录账号" />
								</div>
							</div>
							
							<div class="form-group">
								<div class="col-sm-2 control-label">所属部门</div>
							   	<div class="col-sm-10">
							       <input type="text" class="form-control" style="cursor:pointer;" v-model="info.department.deptName" @click="deptInfoTree" readonly="readonly" placeholder="所属部门"/>
							    </div>
							</div>
							
							<div class="form-group">
								<div class="col-sm-2 control-label">昵称</div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="info.nickName"
										placeholder="昵称" />
								</div>
							</div>
							
							<div class="form-group">
								<div class="col-sm-2 control-label">性别</div>
								<div class="col-sm-10">
									<select v-model="info.sex" class="form-control">
										<option value="0">女</option>
										<option value="1">男</option>
									</select>
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-2 control-label">出生日期</div>
								<div class="col-sm-10 layui-input-inline">
									<input id="birthday" type="text" v-model="info.birthday" 
										class="form-control"
										@click="selectDate"
										placeholder="出生日期">
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-2 control-label">手机号</div>
								<div class="col-sm-10">
									<input type="text" class="form-control"
										v-model="info.telephone" placeholder="手机号" />
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-2 control-label">邮箱</div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="info.email"
										placeholder="邮箱" />
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-2 control-label">住址</div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="info.address"
										placeholder="住址" />
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-2 control-label">启用状态</div>
								<div class="col-sm-10">
									<label class="radio-inline"><input type="radio" name="status" value="0" v-model="info.locked"/>正常</label>
									<label class="radio-inline"><input type="radio" name="status" value="1" v-model="info.locked"/>禁用</label>
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-2 control-label">备注</div>
								<div class="col-sm-10">
									<input type="text" class="form-control"
										v-model="info.description" placeholder="备注" />
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-2 control-label"></div>
								<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定" /> &nbsp;&nbsp;
								<input type="button" class="btn btn-warning" @click="reload" value="返回" />
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		
		<!-- 部门树 -->
		<div id="deptLayer" style="display: none; padding: 10px;">
			<ul id="deptTree" class="ztree"></ul>
		</div>
		
		<!-- 角色树 -->
		<div id="roleLayer" style="display: none;padding:10px;">
			<ul id="roleTree" class="ztree"></ul>
		</div>

		<script th:src="@{/js/admin/sysuser.js}"></script>
	</div>

</body>
</html>